﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.ComponentModel;

namespace devtm.Editor.Configuration
{


    /// <summary>
    /// PropertiesElement
    /// </summary>
    public class PropertiesElement : INotifyPropertyChanged
    {


        private ElementInformation _infos;

        public PropertiesElement(ElementInformation infos)
        {
            _infos = infos;
        }


        /// <summary>
        /// Gets a value indicating whether the associated System.Configuration.ConfigurationElement object is in the configuration file.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is present; otherwise, <c>false</c>.
        /// </value>
        /// <returns>
        /// true if the associated System.Configuration.ConfigurationElement object is in the configuration file; otherwise, false.
        /// </returns>
        [Description("Gets a value indicating whether the associated System.Configuration.ConfigurationElement object is in the configuration file.")]
        [DisplayName("Is present")]
        public bool IsPresent { get { return _infos.IsPresent; } }

        /// <summary>
        /// Gets the line number in the configuration file where the associated System.Configuration.ConfigurationElement object is defined.
        /// </summary>
        /// <value>The line number.</value>
        /// <returns>
        /// The line number in the configuration file where the associated System.Configuration.ConfigurationElement object is defined.
        /// </returns>
        [Description("Gets the line number in the configuration file where the associated System.Configuration.ConfigurationElement object is defined.")]
        [DisplayName("Line number")]
        public int LineNumber { get { return _infos.LineNumber; } }



        /// <summary>
        /// Gets the source file where the associated System.Configuration.ConfigurationElement object originated.
        /// </summary>
        /// <value>The source.</value>
        /// <returns>
        /// The source file where the associated System.Configuration.ConfigurationElement object originated.
        /// </returns>
        [Description("Gets the source file where the associated System.Configuration.ConfigurationElement object originated.")]
        [DisplayName("Source file")]
        public string Source { get { return _infos.Source; } }


        /// <summary>
        /// Gets the type of the associated System.Configuration.ConfigurationElement object.
        /// </summary>
        /// <value>The type.</value>
        /// <returns>
        /// The type of the associated System.Configuration.ConfigurationElement object.
        /// </returns>
        [Description("Gets the type of the associated System.Configuration.ConfigurationElement object.")]
        [DisplayName("Type")]
        public Type Type { get { return _infos.Type; } }


        /// <summary>
        /// Gets the object used to validate the associated System.Configuration.ConfigurationElement object.
        /// </summary>
        /// <value>The validator.</value>
        /// <returns>
        /// The object used to validate the associated System.Configuration.ConfigurationElement object.
        /// </returns>
        [Description("Gets the object used to validate the associated System.Configuration.ConfigurationElement object.")]
        [DisplayName("Validor")]
        public ConfigurationValidatorBase Validator { get { return _infos.Validator; } }


        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion
    }
}
